kvm: fix direct-download live storage migration - #14101
Open
Kunalbehbud wants to merge 3 commits into
Open
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
|
Direct-download backed volumes should not use the linked-clone live storage migration path because the backing chain is not guaranteed on the destination host. Force the KVM migration request to full clone when a migrated volume is direct-download backed, while ignoring volumes that are skipped from the migration request. Keep direct-download volume metadata consistent across VolumeDataFactory paths and make target-connection/template-reference failures explicit. Add unit coverage for forced full-clone, skipped-volume boundaries, copied template references, ModifyTargets answers, and VolumeDataFactory propagation.
Avoid repeating storage pool lookups while deciding and preparing KVM live storage migration requests. Also make the skipped-volume test assert that skipped direct-download volumes do not affect the full-clone decision.
The two-argument overload only existed for the unit tests; the production path always passes the shared storage pool cache. Remove it and have the tests call the real signature.
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
Kunalbehbud
force-pushed
the
fix-kvm-direct-download-live-migration
branch
from
September 9, 2026 15:07
46f851c to
de2dd0a
Compare
14 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes live storage migration for KVM instances whose migrated volumes are backed by direct-download templates.
The problematic path is linked-clone live storage migration. For that mode, libvirt expects the rest of the backing chain to already exist on the destination and to match the source. That assumption is not safe for direct-download backed volumes, where the template may have been bypassed or staged directly on primary storage. When such a volume is part of the actual migration set, this PR forces the KVM migration request to use full-clone storage migration instead.
A few related edge cases are handled in the same path:
shouldMigrateVolumeVolumeDataFactoryImplnow carries the templatedirectDownloadflag consistently across itsgetVolume(...)variants, including volumes whose template was removed laterModifyTargetsCommandfailures preserve the agent error details and empty connected-path answers fail with a clearer exceptionThis keeps the change scoped to the KVM storage migration bug. It does not try to mix linked-clone and full-clone per disk, since the current KVM/libvirt migration command chooses the storage migration mode for the VM migration request as a whole.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
N/A. This is a backend KVM storage migration fix.
How Has This Been Tested?
Targeted unit tests:
mvn -pl engine/storage/datamotion,engine/storage/volume -am \ -Dtest=AncientDataMotionStrategyTest,KvmNonManagedStorageSystemDataMotionTest,StorageSystemDataMotionStrategyTest,VolumeDataFactoryImplTest \ -DfailIfNoTests=false -Dsurefire.failIfNoSpecifiedTests=false testResult: 74 tests run, 0 failures, build success.
Manual verification was also done in a two-host KVM 4.22 test environment:
How did you try to break this feature and the system with this change?
Covered the boundary cases that are most likely to regress this path:
ModifyTargetsCommandreturning a generic failedAnswerModifyTargetsAnswerreturning no connected paths